<%--
  Created by IntelliJ IDEA.
  User: kadsg
  Date: 2023/1/6
  Time: 10:41
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>${floorName}</title>
</head>
<body>
<jsp:include page="../../head/manager.jsp"/>
<div class="container">
    <form action="${pageContext.request.contextPath}/AddSeatController?floorName=${floorName}" method="post">
        <div class="form-group">
            <div class="col-sm-4">
                <div class="input-group ms-end">
                    <input type="number" class="form-control" value="1" min="1" max="15" name="count">
                    <button type="submit" class="btn btn-primary">新增座位</button>
                </div>
            </div>
        </div>
    </form>
</div>
<c:if test="${seatList == null}">
    <div class="container">
        <h4>暂无数据！</h4>
    </div>
</c:if>
<c:if test="${seatList != null}">
    <section class="p-5">
        <div class="container">
            <div class="row g-4">
                <c:forEach items="${seatList}" var="seat" >
                    <div class="col-md">
                        <div class="card">
                            <div class="card-body">
                                <h5 class="card-title">${seat.number}号</h5>
                                <p class="card-text">
                                    <c:if test="${seat.reservation_flag == true}">已被占用</c:if>
                                    <c:if test="${seat.open_flag == false}">未开放</c:if>
                                    <c:if test="${seat.reservation_flag == false && seat.open_flag == true}">空闲中</c:if>
                                    <br>
                                        <%--动作按钮--%>
                                    <c:if test="${seat.open_flag == true}">
                                        <a href="${pageContext.request.contextPath}/CloseSeatController?floorName=${seat.floor_name}&number=${seat.number}" class="btn btn-danger">点击锁定</a>
                                    </c:if>
                                    <c:if test="${seat.open_flag == false}">
                                        <a href="${pageContext.request.contextPath}/OpenSeatController?floorName=${seat.floor_name}&number=${seat.number}" class="btn btn-success">点击开放</a>
                                    </c:if>
                                </p>
                            </div>
                        </div>
                    </div>
                </c:forEach>
            </div>
        </div>
    </section>
</c:if>
</body>
</html>
